package com.wisdom.weld.enumeration;

import lombok.Getter;

@Getter
public enum JdbcType {
    VARCHAR("varchar"),
    CHAR("char"),
    TEXT("text"),
    TINYINT("tinyint"),
    SMALLINT("smallint"),
    INT("int"),
    BIGINT("bigint"),
    FLOAT("float"),
    DOUBLE("double"),
    DECIMAL("decimal"),
    BOOLEAN("boolean"),
    DATE("date"),
    TIME("time"),
    TIMESTAMP("timestamp"),
    DATETIME("datetime")
    ;

    JdbcType(String type) {
        this.type = type;
    }

    private String type;

    public static JdbcType getByType(String type){
        for (JdbcType value : values()) {
            if (value.getType().equals(type)) {
                return value;
            }
        }
        throw new RuntimeException(String.format("不支持Jdbc类型(%s)", type));
    }
}
